﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FAP.DataAccess.BLL;

namespace FapCore
{
    public class DataHelper
    {
        internal void ThemTaiKhoan(taikhoan taikhoan)
        {
            taikhoan.taikhoanInsertRow(taikhoan.tendangnhap, taikhoan.matkhau, taikhoan.email, taikhoan.cookie, taikhoan.ngayhethan, taikhoan.websiteid, taikhoan.trangthai, false);
        }

        internal chitietnghiepvu GetChiTietNghiepVu(int iWebSiteID, int iNghiepVu)
        {
            return chitietnghiepvu.chitietnghiepvuSelectRowByForeignKey_websiteid(iWebSiteID).Where(m=>m.nghiepvuid==iNghiepVu).SingleOrDefault();
        }

        internal bool ThemNghiepVu(chitietnghiepvu c)
        {
            chitietnghiepvu.chitietnghiepvuInsertRow(c.nghiepvuid, c.websiteid, c.trangthai, c.isdeleted);
            return true;
        }

        internal int ThemBuocThucHien(buocthuchien bth)
        {
            return buocthuchien.buocthuchienInsertRow(bth.thutu, bth.trangthai, bth.chitietnghiepvuid, bth.link, bth.method, bth.isdeleted);
        }

        internal void ThemCTBDK(chitietbuocthuchien f)
        {
            chitietbuocthuchien.chitietbuocthuchienInsertRow(f.tenfield, f.kieudulieu, f.fieldformatid, f.dulieumacdinh, f.idbuocthuchien, f.isdeleted);
        }

        internal List<chitietnghiepvu> GetAllChiTietNghiepVu()
        {
            return chitietnghiepvu.chitietnghiepvuSelectAll();
        }

        internal List<website> Laywebsite()
        {
            return website.websiteSelectAll();
        }

        internal fieldformat GetFieldFormatId(int fieldFormatId)
        {
            return fieldformat.fieldformatSelectRow(fieldFormatId);
        }

        internal List<fieldformat> GetAllFieldFormat()
        {
            return fieldformat.fieldformatSelectAll();
        }

        internal void XoaCTBDK(int idbuocthuchien)
        {
            chitietbuocthuchien.chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien(idbuocthuchien);
        }
    }
}
